package oj;

public class Main {
    public static int missingNumber(int[] nums) {
        int n = nums.length;
        int sum = 0;
        int ret = 0;
        for(int i = 0;i <= n;i++){
            sum += i;
        }
        for (int j = 0; j < n; j++) {
            ret += nums[j];
        }
        return sum - ret;
    }

    public static void main(String[] args) {
        int[] nums = {2,3,0,1,6,8,9,4,5};
        System.out.println(missingNumber(nums));
    }
}
